﻿using System;

namespace HouseObj
{
    [Serializable]
    /// <summary>
    /// //楼盘数据对象
    /// </summary>
    public class MyBuildingInfo
    {
        #region Members
        /// <summary>
        /// //楼盘名称
        /// </summary>
        public string name;
        /// <summary>
        /// //楼盘所在城市
        /// </summary>
        public string city;
        /// <summary>
        /// //楼盘所在地区
        /// </summary>
        public string region;
        /// <summary>
        /// //实景图链接
        /// </summary>
        public string realMapUrl;
        /// <summary>
        /// //楼盘详细信息链接
        /// </summary>
        public string detailUrl;
        /// <summary>
        /// //楼盘位置
        /// </summary>
        public string address;
        /// <summary>
        /// //户型配置
        /// </summary>
        public string configuration;
        /// <summary>
        /// //面积大小
        /// </summary>
        public string area;
        /// <summary>
        /// //房屋销售状态
        /// </summary>
        public string onSold;
        /// <summary>
        /// //房屋类型
        /// </summary>
        public string liveType;
        /// <summary>
        /// //房屋平均平米价格
        /// </summary>
        public double avePrice;
        /// <summary>
        /// //网址链接
        /// </summary>
        public string url;
        #endregion

        #region Constructors
        /// <summary>
        /// //构造函数，给各字段赋值
        /// </summary>
        public MyBuildingInfo(string name, string city,string region, string realMapUrl, string detailUrl, string address, string configuration, string area, string onSold, string liveType, string avePrice,string url)
        {
            this.name = name.Trim();
            this.city = city.Trim();
            this.region = region.Trim();
            this.realMapUrl = realMapUrl.Trim();
            this.detailUrl = detailUrl.Trim();
            this.address = address.Trim();
            this.configuration = configuration.Trim();
            this.area = area.Trim();
            this.onSold = onSold.Trim();
            this.liveType = liveType.Trim();
            this.url = url;
            this.avePrice = avePrice == "" ? 0 : Convert.ToInt32(avePrice);
        }
        #endregion

        #region Methods
        /// <summary>
        /// //重载ToString函数
        /// </summary>
        /// <returns>当前对象的字符串</returns>
        public override string ToString()
        {
            string msg = string.Empty;
            msg += "\"" + name + "\",";
            msg += "\"" + city + "\",";
            msg += "\"" + region + "\",";
            msg += "\"" + realMapUrl + "\",";
            msg += "\"" + detailUrl + "\",";
            msg += "\"" + address + "\",";
            msg += "\"" + configuration + "\",";
            msg += "\"" + area + "\",";
            msg += "\"" + onSold + "\",";
            msg += "\"" + liveType + "\",";
            msg += avePrice.ToString() + ",";
            msg += "\"" + url + "\"";
            return msg;
        }
        #endregion
    }
}
